/*
    Copyright © 2010  Ahti Legonkov
    
    This file is part of j+-.
    
    j+- is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.
    
    j+- is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
    
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

package cx.ath.skyflyer.javapm.util;

/**
 * @author Ahti Legonkov
 */
public class Message {

    public enum Level {
        Error,
        Warning1,
        Warning2,
        Warning3,
        Warning4,
    };


    public final Level Severity;
    public final String Message;
    public final String File;
    public final int Line;
    public final int Column;

    public Message(Level severity, String message, String file, int line, int column) {
        this.Severity = severity;
        this.Message = message;
        this.File = file;
        this.Line = line;
        this.Column = column;
    }

    @Override
    public String toString() {
        StringBuffer res = new StringBuffer();
        res
                .append(File).append(":")
                .append(Line).append(": ");
        
        if (Severity == Level.Error)
            res.append("error: ");
        else
            res.append("warning: ");

        res.append(Message);

        return res.toString();
    }
}
